package com.skyable.account.controller;

import com.skyable.account.entity.SysCompanyApply;
import com.skyable.account.service.ICompanyApplyService;
import com.skyable.common.common.ResponseResult;
import com.skyable.common.common.ServiceResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author GaoYuan
 * @title: PublicController
 * @projectName private-cloud
 * @description: TODO
 * @date 2021/6/3011:08
 */
@Api(value = "公共接口")
@RestController
@RequestMapping("public")
public class PublicController extends BaseController {

    @Autowired
    private ICompanyApplyService companyApplyService;

    /**
     * 租户申请
     * @param sysCompanyApply
     * @return
     */
    @ApiOperation(value = "租户申请")
    @PostMapping("/company/apply")
    public ResponseResult companyApply(@RequestBody SysCompanyApply sysCompanyApply, HttpServletRequest request) {
        ServiceResult<SysCompanyApply> serviceResult = companyApplyService.sysCompanyApply(sysCompanyApply);
        if(!serviceResult.getSuccess()) {
            return ResponseResult.error(serviceResult.getCode(),serviceResult.getMessage());
        }
        return ResponseResult.success(serviceResult.getResult());
    }

}
